﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseMarketsInfo.aspx.cs"
    Inherits="RN.ERP.Web.Enterprise.EnterpriseMarketsInfo" %>

<%@ Register Src="~/UserControl/UCCityArea.ascx" TagName="UCArea" TagPrefix="ucArea" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>市场范围</title>
    <link type="text/css" href="/Styles/style.css" />
    <link id="Link1" runat="server" href="../Styles/skins/blue/css/style.css" rel="stylesheet"
        type="text/css" />
    <link id="Link2" runat="server" href="../Styles/skins/blue/css/style_msg.css" rel="stylesheet"
        type="text/css" />
    <script language="javascript" src="../Scripts/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Scripts/json-data.js"></script>
    <style type="text/css">
        .IE6png
        {
            behavior: url("Script/iepngfix.htc");
        }
        .btn
        {
            width: 60px;
            height: 31px;
            border: 0;
            background: url(../images/btn_bg.jpg) left top no-repeat;
            padding: 0;
            margin: 0;
        }
        .embrancheTitle
        {
            text-align: right;
            font-size: 14px;
            height: 40px;
        }
        .center
        {
            clear: both;
        }
        .styleContentMarket
        {
            display: none;
            background: none repeat scroll 0 0 #FFFFFF;
            border: 1px solid #CECBCE;
            width: 300px;
            padding-top: 14px;
            padding-left: 20px;
            padding-right: 20px;
            position: absolute;
            padding-bottom: 20px;
            right: 1px;
            top: 31px;
        }
        .styleTitleMarket
        {
            cursor: pointer;
            border: 1px solid #CECBCE;
            z-index: 1;
            position: relative;
            padding: 0px 10px 0px 10px; /*background: url(images/liulan_r.jpg) 80px center no-repeat #FFFFFF;*/
            background-color: #FFFFFF;
            height: 30px;
            line-height: 25px;
            top: 1px;
            margin-top: 2px;
        }
        .buttonClass
        {
            width: 60px;
            height: 31px;
            border: 0;
            background: url(../images/btn_bg.jpg) left top no-repeat;
            padding: 0;
            margin: 0;
        }
    </style>
    <script type="text/javascript">
        function MarketAdd() {
            //            var win = $find("RadWindow1");
            //            win.show();
            $(".styleContentMarket").toggle();
        }
        $(function () {
            $(".close_cssMarket").click(function () {
                $(".styleContentMarket").toggle();
            });
            $(".buttonClass").click(function () {
                var areaCode = $("input:hidden[id*='hidCityCode']").val();
                var areaTitle = $("#AreaCodeAdd_lblAdress").text();
                if (areaCode == null || areaCode == "") {
                    $.ligerDialog.warn("请选择市场范围");
                }
                radconfirm('确定添加该市场范围？', AddMarket, 300, 150, null, '提示');
                return false;
                function AddMarket(arg) {
                    if (arg) {
                        $.getJSON("../Handlers/EnterpriseCorpInfoHandler.ashx", { "action": "AddMarket", "data": areaCode, "rand": Math.random() }, function (data) {
                            var result = eval(data);
                            if (result.Result = true) {
                                var oArg = new Object();
                                oArg.Result = 1;
                                oArg.Type = "Add";
                                parent.window.Refresh("Add", areaTitle); ////调用父窗体的刷新方法
                                //window.parent.$.ligerDialog.close(); ////关闭dialog
                                //parent.$(".l-dialog,.l-window-mask").remove(); ////去除父窗体遮罩层
                            }
                            else {
                                $.ligerDialog.warn(result.Message);
                            }

                        });
                    }
                }
            }
            );
            $(".marketChange").each(function () {
                $(this).click(function () {
                    var areaCode = $(this).attr("areacode");
                    var obj = $(this).parent();
                    var areaTitle = obj.children(".marketArea").text();
                    if (areaCode == null || areaCode == "") {
                        $.ligerDialog.warn("市场范围错误");
                        return;
                    }
                    radconfirm('确定切换到' + areaTitle + '市场？', doChange, 300, 150, null, '提示');
                    return false;
                    function doChange(arg) {
                        if (arg) {
                            $.getJSON("../Handlers/EnterpriseCorpInfoHandler.ashx", { "action": "ChangeMarket", "data": areaCode, "rand": Math.random() }, function (data) {
                                var result = eval(data);
                                if (result.Result = true) {
                                    var oArg = new Object();
                                    oArg.Result = 1;
                                    oArg.Type = "Change";

                                    parent.window.Refresh("Change", areaTitle); ////调用父窗体的刷新方法


                                    //                                    var win = GetRadWindow();

                                    //                                    win.close(oArg);

                                }

                            });
                        }
                    }
                }
            );
            }
            );
        }
        );

        function GetRadWindow() {
            var oWindow = null;

            if (window.radWindow) oWindow = window.radWindow;

            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;

            return oWindow;

        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
            <tr>
                <td width="16" class="title_lbg IE6png">
                </td>
                <td width="24" class="title_scfv IE6png">
                </td>
                <td width="443" class="title_libg IE6png">
                    市场范围
                </td>
                <td width="17" class="title_rbg IE6png">
                </td>
            </tr>
            <tr>
                <td class="border_lbg IE6png">
                </td>
                <td colspan="2">
                    <div class="xian">
                        <div class="about_title">
                            当前市场范围</div>
                    </div>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table">
                        <tr>
                            <td width="23%" height="24" align="right" bgcolor="#ebebeb">
                                当前地区
                            </td>
                            <td width="22%">
                                <asp:literal runat="server" id="ltrCurrentMarket"></asp:literal>
                            </td>
                            <td width="30%" height="24" align="right" bgcolor="#ebebeb">
                                审核状态
                            </td>
                            <td width="25%">
                                <asp:literal runat="server" id="ltrCurrentMarketFlow"></asp:literal>
                            </td>
                        </tr>
                    </table>
                    <div class="xian">
                        <div class="about_title">可用市场范围</div>
                        <div class="fr">
                            <div id="divSelector" style="float: right; height: 26px; position: relative; z-index: 2;">
                                <div id="divAddMarket" runat="server">
                                    <a href="javascript:void(0)" onclick="MarketAdd()">
                                        <img src="../images/add.jpg" width="70" height="26" />
                                    </a>
                                </div>
                                <div class="styleContentMarket">
                                    <div style="text-align: right; padding-bottom: 6px;">
                                        <img src="../Images/deleteicon00.jpg" style="cursor: pointer;" class="close_cssMarket"
                                            width="12" height="12" title="关闭" />
                                    </div>
                                    <div>请选择市场范围</div>
                                    <div>
                                        <ucarea:ucarea id="AreaCodeAdd" runat="server" isremoveexistembrancharea="true" onlycontainsprovincecity="true"
                                            exceptareas="" />
                                    </div>
                                    <div style="clear: both;">
                                    </div>
                                    <div style="height: 20px;">
                                    </div>
                                    <div>
                                        <input type="button" class="buttonClass" value="确定" />
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <asp:repeater id="rptMarket" runat="server">
                        <ItemTemplate>
                            <div class="marketItem">
                                <div class="marketArea"><%# GetAreaTitle( Eval("areaCode")) %></div>
                                <%--<div class="marketLine"></div>--%>
                                <div class="marketFlow"><%#GetFlowTitle(Eval("areaCode"))%></div>
                                <div class="marketChange" title="切换到该市场" areacode="<%#Eval("areaCode")%>"></div>
                            </div>
                        </ItemTemplate>
                    </asp:repeater>
                </td>
                <td class="border_rbg IE6png">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="border_lconer IE6png" headers="17">
                    &nbsp;
                </td>
                <td colspan="2" class="border_bottomli IE6png" height="17">
                    &nbsp;
                </td>
                <td class="border_rconer IE6png" headers="17">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <div id="tips" runat="server" visible="false">
                        <font color="red">*您尚未添加任何市场范围，请先添加需要办理业务的市场范围</font></div>
                </td>
            </tr>
        </table>
    </div>
    <telerik:radscriptmanager id="RadScriptManager1" runat="server">
    </telerik:radscriptmanager>
    <telerik:radwindowmanager id="RadWindowManager1" runat="server" enableshadow="true"
        height="700px" width="820px" behaviors="Close" showcontentduringload="false"
        modal="true" skin="WebBlue">
                    <Windows>
                        <telerik:RadWindow ID="radWindowQuality" runat="server">
                        </telerik:RadWindow>
                    </Windows>
                   
                </telerik:radwindowmanager>
    </form>
</body>
</html>
